﻿@model abc.Models.JobOpening
@{
    ViewBag.Title = "EditJobOpeningInformation";
    Layout = "~/Views/Shared/_LayoutPageAdmin.cshtml";
}
<div id="page-wrapper">
    <div class="container-fluid">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="EditJobOpening-information">Edit Job Opening Information</h4>
                </div>

                <div class="panel-body">
                    @{
                        using (@Html.BeginForm("SaveJobOpeningInformation","Admin", FormMethod.Post, new { @class = "form-horizontal" }))
                        {
                            <fieldset>
                                <legend>Edit Job Opening Information</legend>

                            </fieldset>
                            <br />
                            @Html.HiddenFor(d => d.JobOpenings_Id)
                            <div class="form-group">
                                <label for="Designation_Name" class="col-sm-3 control-label">Designation Name</label>
                                <div class="col-sm-9">
                                    @Html.DropDownListFor(d => d.JobOpenings_DesignationId, (List<SelectListItem>)ViewBag.GetJobOpeningDesignationDropdownData, new { @class = "form-control" })
                                </div>
                            </div>
                        <div class="form-group">
                            <label for="JobOpenings_Title" class="col-sm-3 control-label">Job Title</label>
                                <div class="col-sm-9">
                                    @Html.TextAreaFor(d => d.JobOpenings_Title, new { @class = "form-control", @id = "JobOpenings_Title" })
                                </div>
                            </div>
                                 <div class="form-group">
                                <label for="Designation_Qualification" class="col-sm-3 control-label">Job Type</label>
                                <div class="col-sm-9">
                                    @Html.TextBoxFor(d => d.JobOpenings_JobType, new { @class = "form-control", @id = "JobOpenings_JobType" })
                                </div>
                            </div>

                        <div class="form-group">
                            <label for="JobOpenings_Vaccancies" class="col-sm-3 control-label">Job Type</label>
                                <div class="col-sm-9">
                                    @Html.TextBoxFor(d => d.JobOpenings_Vaccancies, new { @class = "form-control", @id = "JobOpenings_Vaccancies" })
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="JobOpenings_Location" class="col-sm-3 control-label">Location</label>
                                <div class="col-sm-9">
                                    @Html.TextBoxFor(d => d.JobOpenings_Location, new { @class = "form-control", @id = "JobOpenings_Location" })
                                </div>
                            </div>
                        <div class="form-group">
                            <label for="JobOpenings_WorkExperience" class="col-sm-3 control-label">Work Experience Required</label>
                                <div class="col-sm-9">
                                    @Html.TextBoxFor(d => d.JobOpenings_WorkExperience, new { @class = "form-control", @id = "JobOpenings_WorkExperience" })
                                </div>
                            </div>
                   
                        <div class="form-group">
                            <label for="date-picker-2" class="control-label col-sm-3">Job Post Date</label>
                            <div id="DateTimePicker1"class="input-append date col-sm-9" >                                                                                                                          
                                <div class="input-group" >
                                    <input type="hidden" name="JobOpenings_PostDateTime" value="@Model.JobOpenings_PostDateTime.ToShortDateString()" id="JobPostDate" />
                                    <input type="text" style="color:black" id="TextFromPostDate"data-format="DD-MM-YYYY" disabled="disabled" class="form-control" />
                                    <div class="input-group-addon">
                                          <i class="fa fa-calendar"></i>
                                    </div>
                                </div>                       
                           </div>
                       </div>
                            <div class="form-group">
                    <label for="JobOpening_InterviewVenue" class="col-sm-3 control-label">Interview Venue</label>
                    <div class="col-sm-9">
                        @Html.TextBoxFor(d => d.JobOpening_InterviewVenue, new { @class = "form-control", @id = "JobOpening_InterviewVenue" })
                        @*<input type="text" name="JobOpening_Description" value=" " id="JobOpening_Description" class="form-control" />*@
                    </div>
                </div>   
                        <div class="form-group">
                    <label for="date-picker-2" class="control-label col-sm-3">Interview Date</label>
                    <div id="DateTimePicker2" class="input-append date col-sm-9">
                        <div class="input-group">
                            <input type="hidden" name="JobOpenings_InterviewDate" value="@Model.JobOpenings_InterviewDate.ToShortDateString()" id="HID" />
                            <input type="text" style="color:black" id="TextJID" data-format="DD-MM-YYYY" disabled="disabled" class="form-control" />
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                        </div>
                    </div>
                </div>
                            <br />
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <button type="submit" onclick="SaveDetails(this)" class="btn btn-lg btn-primary">Save changes</button>
                                </div>

                                <div class="col-sm-3">
                                    <button type="button" class="btn btn-lg btn-default" onclick="location.href='@Url.Action("ShowJobOpeningsInformation", "Admin")'">Cancel</button>
                                </div>
                            </div>
                        }
                    }

                </div>
            </div>
        </div>
    </div>
</div>

@section scripts
{
    <script>


        function SaveDetails(e) {
            var TextFrom = $("#TextFromPostDate").val();
            
            $("#JobPostDate").val(TextFrom);
            var TextJobOpeningsInterviewDate = $("#TextJID").val();
            $("#HID").val(TextJobOpeningsInterviewDate);
            e.parentElement.parentElement.submit();
        }

        $(document).ready(function () {
            var HiddenFrom = $("#JobPostDate").val();
           
            $("#TextFromPostDate").val(HiddenFrom);
            var HiddenJobOpeningsInterviewDate = $("#HID").val();
            $("#TextJID").val(HiddenJobOpeningsInterviewDate);
        });

        $('#DateTimePicker1').datepicker(
            { todayBtn: "linked",
                clearBtn: true,
                dateFormat: 'dd-mm-yy',
                minDate: '+5d',
                changeMonth: true,
                changeYear: true,
                inline: true,
                sideBySide: true

            }).on('changeDate', function (e) {
                $(this).datepicker('hide');

          
                });
        $('#DateTimePicker2').datepicker(
                 {

                     todayBtn: "linked",
                     clearBtn: true,
                     dateFormat: 'dd-mm-yy',
                     minDate: '+5d',
                     changeMonth: true,
                     changeYear: true,
                     inline: true,
                     sideBySide: true

                 }).on('changeDate', function (e) {
                     $(this).datepicker('hide');

                 }


                     );


    </script>

    }